package handler

import (
	"github.com/gin-gonic/gin"
	"short-video-hub/model"
)

func Vid(c *gin.Context) {
	title := c.PostForm("title")
	commit := c.PostForm("commit")
	likenum := c.PostForm("likenum")
	data := model.Vid{
		Title:   title,
		Commit:  commit,
		LikeNUm: likenum,
	}
	model.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
	})
	return
}
func VidList(c *gin.Context) {
	var vid []model.Vid
	model.DB.Order("vids.like_n_um").Find(&vid)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
		"data": vid,
	})
	return
}
